Differentiate LIBAVRDUDE_EXIT_FAIL and ..._EXIT_OK
#2061
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LIBAVRDUDE_EXITwas introduced to allow driver functions to tellmain.cthat all is done and avrdude shouldexit(0)indicating success. For example, processing the-x helpoption in a driver should exit.There have been increasingly more situations when driver functions needed to return and suppress error messages from the caller; for these
LIBAVRDUDE_EXITwas used but now avrdude wrongly indicated success to the shell when it should indicate an error.This PR replaces
LIBAVRDUDE_EXITwithLIBAVRDUDE_EXIT_FAILorLIBAVRDUDE_EXIT_OKas appropriate indicating error or success to the shell, respectively.This review uncovered a documentation error for
-x mode=avrthat actually does not exit if the programmer was already in AVR mode. Also fixed.Please @MCUdude could you test/review this PR, in particular wrt the
-x mode=cases for PICkit4/snap.As always, you can figure out whether AVRDUDE returns success or failure to the shell with
&&and||as in